#include <stdio.h>

void hanoi(int n, char first, char second, char third);

int main(void)
{
	int m;
	
	printf("Input a positive integer: ");
	scanf("%d", &m);
	hanoi(m, 'A', 'B', 'C');
	
	return 0;
}

void hanoi(int n, char first, char second, char third)
{
	if (n > 1)
	{
		hanoi(n - 1, first, third, second);
		printf("Move disk %d from %c to %c.\n", n, first, third);
		hanoi(n - 1, second, first, third);
	}
	else
		printf("Move disk %d from %c to %c.\n", n, first, third);
}